package com.im.partchat.ui.activity.more;

import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.im.partchat.App;
import com.im.partchat.R;
import com.im.partchat.base.BaseActivity;
import com.im.partchat.utils.AppManager;
import com.im.partchat.utils.Navigation;
import com.im.partchat.widget.DataCleanManager;
import com.im.partchat.widget.dialog.CommomDialog;

import butterknife.BindView;
import butterknife.OnClick;

public class SettingActivity extends BaseActivity {

    @BindView(R.id.tv_change_password)
    TextView tvChangePassword;
    @BindView(R.id.tv_clear_cache)
    TextView tvClearCache;
    @BindView(R.id.tv_check_version)
    TextView tvCheckVsersion;
    @BindView(R.id.btn_logOut)
    Button btnLogOut;



    @Override
    protected int getLayoutId() {
        return R.layout.activity_seeting;
    }

    @Override
    protected void initData() {

    }

    @Override
    public void onLoadDataSuccess(Object o, String flag) {

    }

    @OnClick({R.id.tv_change_password, R.id.tv_clear_cache, R.id.tv_check_version, R.id.btn_logOut})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_change_password:
                Navigation.navigateChangePassword();

                break;
            case R.id.tv_clear_cache:
                CommomDialog commomDialog=new CommomDialog(this);
                commomDialog.setTitle("确定要清除缓存吗？")
                        .setPositiveOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                DataCleanManager.clearAllCache(getApplicationContext());
                                showToast("清除缓存成功");
                            }
                        })
                        .show();
                break;
            case R.id.tv_check_version:
              showToast("当前是最新版本");
                break;
            case R.id.btn_logOut:
                CommomDialog exitDialog=new CommomDialog(this);
                exitDialog.setTitle("确定要退出登录吗？")
                        .setPositiveOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {

                                App.setUserBean(null);
                                AppManager.getAppManager().finishAllActivity();
                                finish();
                            }
                        })
                        .show();
                break;
        }
    }
}
